﻿using System;
using BikeBouncer.BusinessLayer;
using BikeBouncer.BusinessLayer.Entities;
using BikeBouncer.Site.Enums;
using Devv.Core.Utils;

namespace BikeBouncer.Site
{
	public partial class ViewBike_aspx : BasePage
	{
		#region Page methods

		protected void Page_Load(Object sender, EventArgs e)
		{
			SessionManager.NeedsUserLogin();

			LoadBike(GetIdFromQuery("bike"));
		}

		private void LoadBike(Int32 id)
		{
			Item item = new Item(id);

			if (item.Id < 1)
			{
				DataInvalidRedirect();
			}

			Title = GetLocalResourceObject("PageTitle") + " " + item.Title;
			H1 = GetLocalResourceObject("PageH1") + " " + item.Title;

			ImgBikePicture.ImageUrl = item.PictureUrl;

			TxtDetails.Text = item.Details;
		}

		#endregion
	}
}